package com.huawei.appmarket.service.store.awk.card;

import android.content.Context;
import android.text.SpannableString;
import android.view.View;
import android.widget.CheckBox;
import android.widget.ImageView;
import android.widget.TextView;
import com.huawei.appgallery.foundation.card.base.bean.BaseDistCardBean;
import com.huawei.appgallery.foundation.ui.framework.cardkit.bean.CardBean;
import com.huawei.appmarket.service.store.awk.bean.AppZoneTraceInfoCardBean;
import o.azb;
import o.cdb;
import o.cdg;
import o.cgz;
import o.chm;
import o.dof;
import o.ContentManager;
import o.eqx;
import o.ewm.d;
import o.ewm.j;
import o.ewm.n;

public class AppZoneTraceEditCard extends AppZoneTraceInfoCard {
    private TextView ʻ;
    private CheckBox ʽ;
    private TextView ˋ;
    private View ॱॱ;
    private ImageView ᐝ;

    public AppZoneTraceEditCard(Context context) {
        super(context);
    }

    public cgz ˏ(View view) {
        ˏ((ImageView) view.findViewById(j.ʻˊ));
        azb.ॱ(ʼॱ());
        ॱ((TextView) view.findViewById(j.ʽ));
        ˎ((CheckBox) view.findViewById(j.ᶫ));
        azb.ʻ(this.ʽ);
        ˏ((TextView) view.findViewById(j.ˋ));
        this.ˋ = (TextView) view.findViewById(j.ˋʻ);
        this.ॱॱ = view.findViewById(j.ᐩ);
        azb.ˋ(this.ॱॱ, (azb.ˊ(this.ʼॱ) + this.ʼॱ.getResources().getDimensionPixelSize(d.ॱˊ)) + this.ʼॱ.getResources().getDimensionPixelSize(d.ᐝ), azb.ˏ(this.ʼॱ));
        this.ᐝ = (ImageView) view.findViewById(j.ᐨʼ);
        ʽ(view);
        return this;
    }

    private void ˎ(CheckBox checkBox) {
        this.ʽ = checkBox;
    }

    private void ˏ(TextView textView) {
        this.ʻ = textView;
    }

    public void ˏ(CardBean cardBean) {
        BaseDistCardBean baseDistCardBean = (BaseDistCardBean) cardBean;
        this.ˊᐝ = cardBean;
        if (cardBean != null) {
            ˊ(baseDistCardBean, cardBean);
        }
    }

    private void ˊ(BaseDistCardBean baseDistCardBean, CardBean cardBean) {
        if (this.ʽॱ != null) {
            eqx.ˏ(this.ʽॱ, cardBean.ॱˌ(), "defaultPresetResourceKey");
        }
        if (this.ʿ != null) {
            if (baseDistCardBean.ʽॱ() != null) {
                this.ʿ.setText(baseDistCardBean.ʽॱ());
            } else {
                this.ʿ.setText(cardBean.v_());
            }
        }
        if (cardBean instanceof AppZoneTraceInfoCardBean) {
            AppZoneTraceInfoCardBean appZoneTraceInfoCardBean = (AppZoneTraceInfoCardBean) cardBean;
            String ॱـ = appZoneTraceInfoCardBean.ॱـ();
            if (appZoneTraceInfoCardBean.ㆍ() == 1) {
                this.ʽ.setChecked(true);
            } else {
                this.ʽ.setChecked(false);
            }
            if (((cdg) cdb.ॱ(cdg.class)).ॱॱ(ॱـ)) {
                this.ʻ.setText(ContentManager.getInstant().getContext().getString(n.ʽꞌ));
                this.ʽ.setVisibility(0);
            } else {
                this.ʻ.setText(ContentManager.getInstant().getContext().getString(n.ʽˉ));
                this.ʽ.setVisibility(0);
            }
            ˊ(appZoneTraceInfoCardBean);
            this.ॱॱ.setVisibility(ˊᐝ() ? 0 : 8);
        }
    }

    private void ˊ(AppZoneTraceInfoCardBean appZoneTraceInfoCardBean) {
        if (appZoneTraceInfoCardBean.ꓸ() == 0) {
            ˏ(appZoneTraceInfoCardBean);
        } else {
            ˎ(appZoneTraceInfoCardBean);
        }
    }

    private void ˎ(AppZoneTraceInfoCardBean appZoneTraceInfoCardBean) {
        if (ॱ(appZoneTraceInfoCardBean)) {
            this.ʽ.setVisibility(0);
        } else {
            this.ʽ.setVisibility(8);
        }
        if (appZoneTraceInfoCardBean.ٴ() != 0) {
            this.ˋ.setVisibility(8);
            CharSequence ߴ = appZoneTraceInfoCardBean.ߴ();
            if (!dof.ˋ(ߴ)) {
                this.ʻ.setVisibility(0);
                this.ʻ.setText(ߴ);
            }
            String ՙ = appZoneTraceInfoCardBean.ՙ();
            if (dof.ˋ(ՙ)) {
                this.ᐝ.setVisibility(8);
                return;
            }
            this.ᐝ.setVisibility(0);
            eqx.ˎ(this.ᐝ, ՙ);
            return;
        }
        this.ᐝ.setVisibility(8);
        if (dof.ˋ(appZoneTraceInfoCardBean.ॱˋ())) {
            this.ˋ.setVisibility(8);
        } else {
            this.ˋ.setVisibility(0);
        }
    }

    private void ˏ(AppZoneTraceInfoCardBean appZoneTraceInfoCardBean) {
        if (!dof.ˋ(appZoneTraceInfoCardBean.ˊˋ())) {
            CharSequence spannableString = new SpannableString(ContentManager.getInstant().getContext().getString(n.ʽᐨ));
            spannableString.setSpan(chm.ॱ().ʽ(), 0, spannableString.length(), 33);
            this.ʻ.setText(spannableString);
            this.ʽ.setVisibility(8);
        }
        if (dof.ˋ(appZoneTraceInfoCardBean.ॱˋ())) {
            this.ˋ.setVisibility(8);
        } else {
            this.ˋ.setVisibility(0);
        }
        this.ᐝ.setVisibility(8);
    }

    private boolean ॱ(AppZoneTraceInfoCardBean appZoneTraceInfoCardBean) {
        if ((appZoneTraceInfoCardBean.ˌ() & 1) == 0 && (appZoneTraceInfoCardBean.ˌ() & 2) == 0) {
            return true;
        }
        return false;
    }
}
